/**
*@description 用户画像》品牌联系强度》用户粘度
*@author yhw
*/
import React, { Component, PropTypes } from 'react';
import { routerRedux } from 'dva/router';
import { connect } from 'dva';
import MainLayout from '../components/MainLayout/MainLayout';
import BarSimple from '../components/Persons/BarSimple';
import TableList from '../components/TableList';
import {Card, Icon, Tooltip, Row, Col} from 'antd';

const tips1 = (<div>用户互动粘度&nbsp;
  <Tooltip placement="right" title="用户互动粘度是指用户在一定时间内与品牌进行线上互动活动频率的表现">
          <Icon type="question-circle-o" />
  </Tooltip></div>),
tips2 = (<div>用户购买粘度&nbsp;
  <Tooltip placement="right" title="用户购买粘度是指用户在一定时间内与品牌进行线下互动活动频率的表现">
          <Icon type="question-circle-o" />
  </Tooltip></div>);

class UserViscosity extends Component {
  constructor(props) {
      super(props);
  }
  // 获取数据
  fetchData(type, search){
    this.props.dispatch({
            type: type,
            payload: search
    })
  };
  initData(){
    this.fetchData('UserViscosity/interactiveQuery','');
    this.fetchData('UserViscosity/buyQuery','');
  };
  componentWillMount() {
    this.initData();
  };
  render(){
  return (
    <MainLayout>
        <Row gutter={16} style={{marginTop:"29px"}}>
              <Col className="gutter-row" span={16}>
              <div className="gutter-box">
                        <Card title={tips1}>
                              <BarSimple seriesName="用户互动粘度" data={this.props.UserViscosity.interactiveData} loading={this.props.UserViscosity.interactiveLoading} width={"100%"} height={300} />
                        </Card>
                        <Card title={tips2}>
                              <BarSimple seriesName="用户购买粘度" data={this.props.UserViscosity.buyData} loading={this.props.UserViscosity.buyLoading} width={"100%"} height={300} />
                        </Card>
              </div>
              </Col>
              <Col className="gutter-row" span={8}><div className="gutter-box"><TableList pageSize={18} /></div></Col>
        </Row>
    </MainLayout>
  );
  }
};

UserViscosity.propTypes = {
};

function mapStateToProps({ UserViscosity }) {
  return {
    UserViscosity: {...UserViscosity},
  };
}

export default connect(mapStateToProps)(UserViscosity);